using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using BlueFinity.mvNET.CoreObjects;
using mvLibrary.Helpers.Utils;
namespace fenk.Admin.CajaBancos
{
    public partial class ControlContable : mvLibrary.BaseForm
    {
        public ControlContable()
        {
            InitializeComponent();
        }

        private void ControlContable_Load(object sender, EventArgs e)
        {
            toolBox.Visible = false;
            CallProgram("LOAD.CONTROL.CONTABLE.NET", 1, 1);
            textBox1.Text = DataBASIC.Convert(AplicData.ExtractAsString(1), DataBASIC.VM, DataBASIC.CRLF);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (txtType.Text == "")
            {
                MessageBox.Show("Falta indicar tipo de listado");
                txtType.Focus();
                return;
            }
            var selectedPrinter = cboPrinters.SelectedIndex;
            if (selectedPrinter.Equals(6))
            {
                var typeValue = this.txtType.Text;
                SaveReport();
                UniItem.Replace(3, "1");
                cboPrinters.SelectedIndex = selectedPrinter;
                txtType.Text = typeValue;
                UniItem.Replace(1, typeValue);
            }
            else
            {
                CallProgram("CONTROL.CONTABLE.NET", 1, 1);
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            if (UniItem.ExtractAsString(3) == "")
            {
                if (MessageBox.Show("Actualiza contadores sin haber impreso el listado?", "Actualizar", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    txtType.Focus();
                    return;
                }
            }
            CallProgram("ACT.CONTROL.CONTABLE.NET", 1, 1);
            this.Close();
        }



    }
}

